import { _decorator, CCBoolean, CCFloat, Component, instantiate, Node, Prefab, Vec3 } from 'cc';
import { Skill } from '../Skill';
import { Clone_Skill_Controller } from './Clone_Skill_Controller';
const { ccclass, property } = _decorator;

@ccclass('Clone_Skill')
export class Clone_Skill extends Skill {
    @property(Prefab) clonePrefab:Prefab = null;
    @property(CCFloat) cloneDuration:number = 2;
    @property(CCFloat) colorLoosingSpeed:number = 10;

    @property(CCBoolean) canAttack:boolean = false;
    protected update(dt: number): void {
        super.update(dt);
    }
    public UseSkill():void{
        console.info("Clone")
    }
    createClone(pos:Vec3){
        const newNode = instantiate(this.clonePrefab);
        this.node.addChild(newNode);
        newNode.getComponent(Clone_Skill_Controller).setUpClone(pos,this.cloneDuration,this.colorLoosingSpeed,this.canAttack);
    }
}


